package com.blue.http.filter;

import com.blue.http.message.HttpRequest;
import com.blue.http.message.HttpResponse;
import com.blue.http.util.HttpException;

import java.util.Map;

/**
 * 设置额外参数过滤器
 *
 * @author Jin Zheng
 * @date 2018-10-29
 */
public class SettingFilter implements Filter
{
	private Map<String, String> param;

	public SettingFilter()
	{
	}

	@Override
	public boolean preHandle(HttpRequest request, HttpResponse response) throws HttpException
	{
		if (param != null && !param.isEmpty())
		{
			response.param().putAll(param);
		}

		return true;
	}

	public void setParam(Map<String, String> param)
	{
		this.param = param;
	}

}
